﻿using System;
using YouthCMS.Data;

namespace YouthCMS.Admins
{
    public partial class Teacher : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Username"] == null)
            {
                Response.Redirect("Default.aspx?login=false");

            }
            else
            {
                if (Request.QueryString["delete"] != null)
                {
                    var th = new TeacherHandler();
                    var teacherGone = th.DeleteTeacher(new Data.Teacher { LoginID = int.Parse(Request.QueryString["delete"]) });

                    switch (teacherGone)
                    {
                        case true:
                            Response.Redirect("Default.aspx?teacher=removed");
                            break;
                        default:
                            Response.Redirect("Default.aspx?teacher=error");
                            break;
                    }

                }
            }


        }
    }
}